﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.ManagementConsole;

namespace Google.Apps.MMC
    {
    public class CustomPropertyPage : PropertyPage
        {
        private CustomControl _customcontrol;

        public CustomControl customcontrol
            {
            set
                {
                this._customcontrol = value;
                this.Control = value;
                }
            get
                {
                return this._customcontrol;
                }
            }

        protected override bool OnApply()
            {
                if (this.customcontrol.CanApplyChanges())
                    {
                        if (this.customcontrol.Apply())
                            {
                            return true;
                            }
                        else
                            {
                            return false;
                            }
                    }
                else
                    {
                    return false;
                    }
            }

        protected override void OnCancel()
            {
                this.customcontrol.Cancel();
            }

        protected override bool OnOK()
            {
            return this.OnApply();
            }

        protected override void OnDestroy()
            {
                this.customcontrol.Destroy();
            }

        }
    }
